home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2466 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Checking for a file => Does it exist (Help)
  5. Date: Sun, 21 Jan 96 14:56:59 GMT
  6. Organization: none
  7. Message-ID: <822236219snz@genesis.demon.co.uk>
  8. References: <4d9k6fINNnja@faatcrl.faa.gov> <4dc6kq$dja@gryphon.phoenix.net> <30FCF419.3B44@rennes.cern.ch> <821900925snz@genesis.demon.co.uk> <4dr4d7$n6k@noc.tor.hookup.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4dr4d7$n6k@noc.tor.hookup.net>
  15.            Rajendra_Singh@msn.com "Rajendra Singh" writes:
  16.  
  17. >Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
  18. >
  19. >
  20. >>The C language does not define a function called 'access'. POSIX does but
  21. >>it is rather specialised and probably doesn't do what you want.
  22. >
  23. >That may be true, but EVERY C compiler that I have used has it:  AIX,
  24. >HPUX, Watcom, Borland.
  25.  
  26. It doesn't matter how many platforms support it, if it does the wrong thing
  27. on many of them. Have you read the man page for access on AIX or HPUX,
  28. *carefully* ? While POSIX isn't part of C it is worth quoting the following
  29. to indicate why you shouldn't use access in 'portable' code. From the access
  30. description in  "POSIX Programmer's Guide" by Donald Lewine:
  31.  
  32. ``access uses the real UID, not the effective UID. It is not a general utility
  33.   for finding out "Can I do this?" before doing a call. It is used by SETUID
  34.   programs to check their actions.''
  35.  
  36. If the standard C functions aren't up to your needs probably the most
  37. portable solution to this is to use stat().
  38.  
  39. -- 
  40. -----------------------------------------
  41. Lawrence Kirby | fred@genesis.demon.co.uk
  42. Wilts, England | 70734.126@compuserve.com
  43. -----------------------------------------
  44.